<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/1
 * Time: 21:35
 */


// 后台登录页面
Route::group(['prefix' => 'admin', 'namespace' => 'Admin'], function () {

    //用户认证
    Route::any('login', 'AuthController@login')->name('login')->middleware('AuthCheck');;

    //Route::any('register', 'AuthController@register')->name('register');
    //公共控制器
//    Route::get('login','LoginController@index');
    Route::group(['middleware' => 'auth:admin'], function () {

        Route::get('logout', 'AuthController@logout');
        //首页
        Route::get('index', 'IndexController@index')->name('admin.index');
        //文章页
        Route::get('article', 'ArticleController@index')->name('article');
        //分类页
        Route::get('type', 'TypeController@index')->name('type');

        Route::get('link', 'FriendshipLinkController@index')->name('link');
        //文章
        Route::group(['prefix' => 'article'], function () {
            //文章添加
            Route::get('add', 'ArticleController@create')->name('article.add');
            Route::post('store', 'ArticleController@store')->name('article.store');
            //文章修改
            Route::get('edit', 'ArticleController@edit')->name('article.edit');
            Route::post('edit/{id}', 'ArticleController@update')->name('article.update');
            //文章删除
            Route::post('del', 'ArticleController@del')->name('article.del');
        });

        //分类管理
        Route::group(['prefix' => 'type'], function () {

            //标签添加
            Route::get('add', 'TypeController@create')->name('type.add');
            Route::post('store', 'TypeController@store')->name('type.store');
            //标签删除
            Route::post('del', 'TypeController@delete')->name('type.del');
        });
        //友情链接
        Route::group(['prefix' => 'link'], function () {
            //友情链接添加
            Route::get('add', 'FriendshipLinkController@create')->name('link.add');
            Route::post('store', 'FriendshipLinkController@store')->name('link.store');
            //友情链接删除
            Route::post('del', 'FriendshipLinkController@delete')->name('link.del');
        });
        //标签
        Route::group(['prefix' => 'tag'], function () {
            //标签添加
            Route::get('add', 'TagController@create')->name('tag.add');
            Route::post('store', 'TagController@store')->name('tag.store');
            //标签修改
            Route::get('edit', 'TagController@edit')->name('tag.edit');
            Route::post('edit/{id}', 'TagController@update')->name('tag.update');
            //标签删除
            Route::post('del', 'TagController@delete')->name('tag.del');
        });
        //数据库管理
        //生活点滴 timeline
        Route::group(['prefix' => 'timeline'], function () {
            Route::get('index', 'TimelineController@index')->name('timeline.index');
            //添加
            Route::get('add', 'TimelineController@create')->name('timeline.add');
            Route::post('store', 'TimelineController@store')->name('timeline.store');
            //删除
            Route::post('del', 'TimelineController@delete')->name('timeline.del');
        });
        //项目管理
        Route::group(['prefix' => 'project'], function () {
            Route::get('index', 'ProjectController@index')->name('project.index');
            //添加
            Route::get('add', 'ProjectController@create')->name('project.add');
            Route::post('store', 'ProjectController@store')->name('project.store');
            //删除
            Route::post('del', 'ProjectController@delete')->name('project.del');
        });
        //通知管理
        Route::group(['prefix' => 'notice'], function () {
            Route::get('index', 'NoticeController@index')->name('notice.index');
            //添加
            Route::get('add', 'NoticeController@create')->name('notice.add');
            Route::post('store', 'NoticeController@store')->name('notice.store');
            //删除
            Route::post('del', 'NoticeController@delete')->name('notice.del');
        });
    });
});